package chanfoofoo;


public class VFP_lib {
	public static double vfp_val(String in_str) {
		double result = 0 ;
		in_str = in_str.replace(",", "") ;
		try {
			result = Double.parseDouble(in_str) ;
		} catch (Exception ex) {}
		
		return result ; 
	}
	public static int vfp_int(double in_val) {
		int result = 0 ;
		result = (int)in_val ; 
		return result ; 
	}
	public static String vfp_str(double in_val , int in_width , int in_decimal) {
		String result = null ;
		// vfp str(863.6452 , 10,2) ==> return "863.65"
		String format_str = "%1$." + in_decimal + "f" ; 
		result = String.format(format_str , in_val) ; 
		return result ; 
	}
	public static String zerostr(int in_val , int in_length) {
		String result = null ; 
		String format_str = "%1$0" + in_length + "d" ; 
		result = String.format(format_str , in_val) ; 
		return result ; 
	}
}
